*November 16, 2025
**Wilk, Deza, Hodge, Danagoulian (2025) Couch-Locked with the Munchies: Effects of Recreational Marijuana Laws on Exercise and Nutrition

set segmentsize 1g
set more off
cap log close
eststo clear

********************************************************************************
****************************  MAIN EVENT STUDIES  ******************************
********************************************************************************

***** ALL Paid, Trips, & Amounts *****
* ORDER: Junk Paid, Junk Trip (extensive), Junk Trips (intensive), All Trips, All Spending, All Amount OZ, and All Amount Count
use "consumer_panel_hh_month.dta", clear
drop if st==23
*drop trend_23
*drop g_idm-soda_prop household_income-date_week
gen quarter = ceil(month/3)
drop if quarter==44
gen temp_postq = 0
replace temp_postq = 1 if postm==1
egen postq = max(temp_postq), by(st quarter)
gen temp_startq = 0
replace temp_startq = 1 if startm==1
egen startq = max(temp_startq), by(st quarter)
replace startq = 0 if startq==1 & postq==1
egen temp_g_idq = min(quarter) if postq==1, by(st)
replace temp_g_idq = 0 if temp_g_idq==.
egen g_idq = max(temp_g_idq), by(st)
gen Eiq = .
replace Eiq = g_idq if g_idq!=0

sum quarter, meanonly
gen double t_centered = quarter - r(mean)
levelsof st, local(state)
foreach s of local state {
	gen double trend_`s' = t_centered * (st==`s')
} // state trend loop

local outcomes lnjunk_paid junk_t lnjunk_trip lntotal_trips lntotal_trip_spent
foreach y of local outcomes {
	local results_list
	* Normal FEs
	eststo base_`y': did_imputation `y' fips quarter Eiq [aw=projection_factor], fe(quarter fips startq) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.001)
	estadd ysumm
	event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
	graph export "graphs/es_base_`y'.png", as(png) name("Graph") replace
	keep household_cd-trend_56
	
	*eststo cont_`y': did_imputation `y' fips quarter Eiq [aw=projection_factor], fe(quarter fips start shelter) controls(age2024 edu_hs marry) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.001)
	*estadd ysumm
	*event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
	*graph export "graphs/es_cont_`y'.png", as(png) name("Graph") replace
	*keep household_cd-trend_56
	
	* State Specific Linear Trends (centered quarter-year) 
	*eststo base_t_`y': did_imputation `y' fips quarter Eiq [aw=projection_factor], fe(quarter fips start) controls(trend_*) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.01)
	*estadd ysumm
	*event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
	*graph export "graphs/es_base_t_`y'.png", as(png) name("Graph") replace
	*keep household_cd-trend_56
	
	*eststo cont_t_`y': did_imputation `y' fips quarter Eiq [aw=projection_factor], fe(quarter fips start shelter) controls(age2024 edu_hs marry trend_*) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.01)
	*estadd ysumm
	*event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
	*graph export "graphs/es_cont_t_`y'.png", as(png) name("Graph") replace
	*keep household_cd-trend_56
	
	local results_list base_`y'
	estout `results_list' using "reports/main_event_studies_jpam_rr_1.xls", cells(b(star label(Coef.) fmt(3)) se(par(`"="("'`")""') label(Std. Err.) fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.005) stats(ymean ysd r2 N, fmt(3 3 3 0)) legend label append
	eststo clear
} // all outcomes loop

	eststo base_t_lnjunk_paid: did_imputation lnjunk_paid fips quarter Eiq [aw=projection_factor], fe(quarter fips startq) controls(trend_*) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.001)
	estadd ysumm
	event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
	graph export "graphs/es_base_t_lnjunk_paid.png", as(png) name("Graph") replace
	keep household_cd-trend_56
	
	eststo base_t_lnjunk_trip: did_imputation lnjunk_trip fips quarter Eiq [aw=projection_factor], fe(quarter fips startq) controls(trend_*) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.001)
	estadd ysumm
	event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
	graph export "graphs/es_base_t_lnjunk_trip.png", as(png) name("Graph") replace
	keep household_cd-trend_56

	estout base_t_lnjunk_paid base_t_lnjunk_trip using "reports/main_event_studies_jpam_rr_1.xls", cells(b(star label(Coef.) fmt(3)) se(par(`"="("'`")""') label(Std. Err.) fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.005) stats(ymean ysd r2 N, fmt(3 3 3 0)) legend label append
	eststo clear


***** CATEGORY Paid, Trips, & Amounts *****
* NOTE: amount for categories is part of a new appendix
* added in junk_new to include sugary soda
local type snacks chips cookies icecream candy
foreach x of local type {
	local results_list
	local outcomes ln`x'_paid `x'_t ln`x'_trip lnamt_`x'_oz lnamt_`x'_cnt
	foreach y of local outcomes {
		local results_list
		* Normal FEs
		eststo base_`y': did_imputation `y' fips quarter Eiq [aw=projection_factor], fe(quarter fips start) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.001)
		estadd ysumm
		event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
		graph export "graphs/es_base_`y'.png", as(png) name("Graph") replace
		keep household_cd-trend_56
		
		*eststo cont_`y': did_imputation `y' fips quarter Eiq [aw=projection_factor], fe(quarter fips start shelter) controls(age2024 edu_hs marry) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.01)
		*estadd ysumm
		*event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
		*graph export "graphs/es_cont_`y'.png", as(png) name("Graph") replace
		*keep household_cd-trend_56
		
		* State Specific Linear Trends (centered quarter-year) 
		*eststo base_t_`y': did_imputation `y' fips quarter Eiq [aw=projection_factor], fe(quarter fips start) controls(trend_*) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.01)
		*estadd ysumm
		*event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
		*graph export "graphs/es_base_t_`y'.png", as(png) name("Graph") replace
		*keep household_cd-trend_56
		
		*eststo cont_t_`y': did_imputation `y' fips quarter Eiq [aw=projection_factor], fe(quarter fips start shelter) controls(age2024 edu_hs marry trend_*) horizons(0/12) pretrend(6) cluster(st) autosample maxit(500) tol(0.01)
		*estadd ysumm
		*event_plot, default_look stub_lag(tau#) stub_lead(pre#) graph_opt(xlabel(-6(1)12) xtitle("Quarters Since Enactment") legend(off))	
		*graph export "graphs/es_cont_t_`y'.png", as(png) name("Graph") replace
		*keep household_cd-trend_56
		
		local results_list base_`y'
		estout `results_list' using "reports/main_event_studies_jpam_rr_1.xls", cells(b(star label(Coef.) fmt(3)) se(par(`"="("'`")""') label(Std. Err.) fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.005) stats(ymean ysd r2 N, fmt(3 3 3 0)) legend label append
		eststo clear
	} // outcomes by type loop
} // category loop
*/


********************************************************************************
*******************************  MAIN RESULTS  *********************************
********************************************************************************

***** ALL Paid, Trips, & Amounts *****
* ORDER: Junk Paid, Junk Trip (extensive), Junk Trips (intensive), All Trips, All Spending, All Amount OZ, and All Amount Count
* NOTE: Amount in OZ and Count is for new appendix
* lnjunk_paid junk_t lnjunk_trip lntotal_trips lntotal_trip_spent lnamt_oz lnamt_cnt lnamt_junk_cnt
local outcomes lnamt_junk_oz lnamt_oz
foreach y of local outcomes {
	local results_list
	use "consumer_panel_hh.dta", clear
	*drop g_id-soda_prop household_income-date_week
	*sum `y', detail
	*keep if `y' <= r(p99)
	
	* Normal FEs
	eststo base_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start) cluster(st) autosample maxit(500)
	estadd ysumm
	keep wy-y_trend_56
	*eststo cont_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start shelter) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.001)
	*estadd ysumm
	*keep wy-y_trend_56
	
	* State-Month Interaction FEs
	*eststo sm_base_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start st#month) cluster(st) autosample maxit(500)
	*estadd ysumm
	*keep wy-trend_56
	eststo sm_cont_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start shelter st#month) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	keep wy-trend_56	
	
	* State Specific Linear Trends (centered week-year) 
	*eststo base_t_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start) controls(trend_*) cluster(st) autosample maxit(500) tol(0.01)
	*estadd ysumm
	*keep wy-y_trend_56
	*eststo cont_t_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start shelter) controls(age2024 edu_hs marry trend_*) cluster(st) autosample maxit(500) tol(0.01)
	*estadd ysumm
	*keep wy-y_trend_56
	
	* State Specific Linear Trends (main & appendix) (centered month-year)
	*eststo base_mt_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start) controls(m_trend_*) cluster(st) autosample maxit(500) tol(0.01)
	*estadd ysumm
	*keep wy-y_trend_56
	*eststo cont_mt_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry m_trend_*) cluster(st) autosample maxit(500) tol(0.01)
	*estadd ysumm
	*keep wy-y_trend_56
	
	local results_list base_`y' sm_cont_`y'
	estout `results_list' using "reports/main_results_jpam_rr_2.xls", cells(b(star label(Coef.) fmt(3)) se(par(`"="("'`")""') label(Std. Err.) fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.005) stats(ymean ysd r2 N, fmt(3 3 3 0)) legend label append
	eststo clear
} // all outcomes loop

***** CATEGORY Paid, Trips, & Amounts *****
local type snacks chips cookies icecream candy
foreach x of local type {
	local results_list
	* ln`x'_paid `x'_t ln`x'_trip lnamt_`x'_oz lnamt_`x'_cnt
	local outcomes lnamt_`x'_oz
	foreach y of local outcomes {
		local results_list
		use "consumer_panel_hh.dta", clear
		*drop g_id-soda_prop household_income-date_week
		*sum `y', detail
		*keep if `y' <= r(p99)
		
		* Normal FEs
		eststo base_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start) cluster(st) autosample maxit(500) tol(0.001)
		estadd ysumm
		keep wy-y_trend_56
		*eststo cont_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start shelter) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.001)
		*estadd ysumm
		*keep wy-y_trend_56
		
		* State-Month FEs
		*eststo sm_base_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start st#month) cluster(st) autosample maxit(500)
		*estadd ysumm
		*keep wy-y_trend_56
		eststo sm_cont_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start shelter st#month) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.01)
		estadd ysumm
		keep wy-y_trend_56
		
		* State Specific Linear Trends (centered week-year) 
		*eststo base_t_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start) controls(trend_*) cluster(st) autosample maxit(500) tol(0.01)
		*estadd ysumm
		*keep wy-y_trend_56
		*eststo cont_t_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(wy fips start shelter) controls(age2024 edu_hs marry trend_*) cluster(st) autosample maxit(500) tol(0.01)
		*estadd ysumm
		*keep wy-y_trend_56

		* State Specific Linear Trends (main & appendix) (centered month-year)
		*eststo base_mt_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start) controls(m_trend_*) cluster(st) autosample maxit(500) tol(0.01)
		*estadd ysumm
		*keep wy-y_trend_56
		*eststo cont_mt_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry m_trend_*) cluster(st) autosample maxit(500) tol(0.01)
		*estadd ysumm
		*keep wy-y_trend_56
		
		local results_list base_`y' sm_cont_`y'
		estout `results_list' using "reports/main_results_jpam_rr_2.xls", cells(b(star label(Coef.) fmt(3)) se(par(`"="("'`")""') label(Std. Err.) fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.005) stats(ymean ysd r2 N, fmt(3 3 3 0)) legend label append
		eststo clear
	} // outcomes by type loop
} // category loop




********************************************************************************
********************************  APPENDICES  **********************************
********************************************************************************

***** FIVE Main Outcomes *****
local outcomes ln_junk_paid junk_t lnjunk_trip lntotal_trips lntotal_trip_spent
foreach y of local outcomes {
	local results_list
	use "consumer_panel_hh.dta", clear
	drop g_idq-soda_prop household_income-date_week
	sum `y', detail
	keep if `y' <= r(p99)
	
	* TWFE & Gardner
	eststo twfe_`y': reghdfe `y' i.post_start i.start i.shelter age2024 edu_hs marry [aw=projection_factor] if period>=-78 & period<=78, absorb(i.fips i.wy) cluster(st)
	estadd ysumm
	keep wy-y_trend_56
	eststo twfe_t_`y': reghdfe `y' i.post_start i.start i.shelter age2024 edu_hs marry [aw=projection_factor] if period>=-78 & period<=78, absorb(i.fips i.wy trend_*) cluster(st)
	estadd ysumm
	keep wy-y_trend_56
	eststo gard_`y': did2s `y' [aw=projection_factor] if period>=-78 & period<=78, first_stage(i.fips i.wy i.start i.shelter age2024 edu_hs marry) second_stage(post_start) treatment(post_start) cluster(st)
	estadd ysumm
	keep wy-y_trend_56
	eststo gard_t_`y': did2s `y' [aw=projection_factor] if period>=-78 & period<=78, first_stage(i.fips i.wy i.start i.shelter age2024 edu_hs marry trend_*) second_stage(post_start) treatment(post_start) cluster(st)
	estadd ysumm
	keep wy-y_trend_56
	
	* State Specific Linear Trends (centered year)
	eststo cont_yt_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry y_trend_*) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	keep wy-y_trend_56
	
	* Different Time Frames
	local time 104 156
	foreach t of local time {
		eststo cont_`y'_`t': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-`t' & period<=`t', fe(fips wy start shelter) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.01)
		estadd ysumm
		keep wy-y_trend_56
		eststo cont_t_`y'_`t': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-`t' & period<=`t', fe(fips wy start shelter) controls(age2024 edu_hs marry trend_*) cluster(st) autosample maxit(500) tol(0.01)
		estadd ysumm
		keep wy-y_trend_56
	} // timeframe loop
	
	* COVID Continues & Pre-COVID
	eststo covd_`y': did_imputation `y' fips wy Eiq [aw=projection_factor], fe(wy fips start shelter2) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	keep wy-y_trend_56
	eststo covd_t_`y': did_imputation `y' fips wy Eiq [aw=projection_factor], fe(wy fips start shelter2) controls(age2024 edu_hs marry trend_*) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	keep wy-y_trend_56
	
	keep if panel_year <= 2019
	replace Ei = . if Ei==471 | Ei==511
	eststo pre_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	keep wy-y_trend_56
	eststo pre_t_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry trend_*) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	
	* Borders Exclusion & States
	use "consumer_panel_hh.dta", clear
	drop g_idq-soda_prop household_income-date_week
	sum `y', detail
	keep if `y' <= r(p99)
	drop if border_excl==1
	eststo bord_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	keep wy-y_trend_56
	eststo bord_t_`y': did_imputation `y' fips wy Ei [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry trend_*) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	* drop RML states
	use "consumer_panel_hh.dta", clear
	drop g_idq-soda_prop household_income-date_week
	sum `y', detail
	keep if `y' <= r(p99)
	drop if st==8 | st==53 | st==11 | st==41 | st==2 | st==32 | st==6 | st==25 | st==26 | st==17 | st==23
	eststo neigh_`y': did_imputation `y' fips wy Eib [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry) cluster(st) autosample maxit(500) tol(0.001)
	estadd ysumm
	keep wy-y_trend_56
	eststo neigh_t_`y': did_imputation `y' fips wy Eib [aw=projection_factor] if period>=-78 & period<=78, fe(fips wy start shelter) controls(age2024 edu_hs marry trend_*) cluster(st) autosample maxit(500) tol(0.01)
	estadd ysumm
	
	local results_list twfe_`y' twfe_t_`y' gard_`y' gard_t_`y' cont_yt_`y' cont_`y'_104 cont_t_`y'_104 cont_`y'_156 cont_t_`y'_156 covd_`y' covd_t_`y' pre_`y' pre_t_`y' bord_`y' bord_t_`y' neigh_`y' neigh_t_`y'
	estout `results_list' using "reports/appendices_jpam_rr_1.xls", cells(b(star label(Coef.) fmt(3)) se(par(`"="("'`")""') label(Std. Err.) fmt(3))) starlevels(+ 0.10 * 0.05 ** 0.01 *** 0.005) stats(ymean ysd r2 N, fmt(3 3 3 0)) legend label append
	eststo clear
} // all outcomes loop

***** End-of-File *****
